<?php
class Modelroadbook_way extends ModelBase {
	
	protected $tablename = 'roadbook_way';
	/**
	 *
	 * @var CDbConnection
	 */
	function __construct() {
		parent::__construct ();
	}
	
	
	
	function getRcount($wherearr=0) {
		return parent::getRcount ( $this->tablename,$wherearr );
	}
	
	// 添加或修改 路书 途径地
	function replaceTable($updatear) {
		return parent::replaceTable ( $this->tablename, $updatear );
	}
	
	// 除景点
	function delTable($where) {
		return parent::deleteTable ( $this->tablename, $where );
	
	}
	
	function getTable($where,$limit=1) {
		return parent::getTable ( $this->tablename, $where,0,$limit );
	}
	
	function getRoadWay($wherearr){
		$where = '';
		$array = array();	
		if ($wherearr) {
			$num = 0;
				
			foreach ( $wherearr as $k => $v ) {
				if ($num == 0) {
					$where = ' where ';
				}
		
				if ($v || ($v == 0)) {
					if ($num != 0) {
						$where .= ' and ';
					}
						
					$where .= $k . "='" . $v . "'";
						
					$num ++;
				}
			}
				
		}
		global $_SGLOBAL;
		$sql = "SELECT * FROM ".$this->tablename." wr left join view_way vw on wr.way_id=vw.way_id ".$where;
		$query_offica1 = $_SGLOBAL ['db']->query ( $sql );
			
		while ( $value = $_SGLOBAL ['db']->fetch_row () ) {
			$array [] = ($value);
		}
			
		return $array;
	}
	
	

}
?>
